home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / xlib04.zip / XCIRCLE.ASM < prev    next >
Assembly Source File  |  1992-11-12  |  17KB  |  715 lines

  1. ;-----------------------------------------------------------------------
  2. ;
  3. ; MODULE XCIRCLE
  4. ;
  5. ;   This module was written by Matthew MacKenzie
  6. ;   matm@eng.umd.edu
  7. ;
  8. ; Circles, full and empty.
  9. ;
  10. ; Compile with Tasm.
  11. ; C callable.
  12. ;
  13. ; ****** XLIB - Mode X graphics library                ****************
  14. ; ******                                               ****************
  15. ; ****** Written By Themie Gouthas                     ****************
  16. ; ****** Aeronautical Research Laboratory              ****************
  17. ; ****** Defence Science and Technology Organisation   ****************
  18. ; ****** Australia                                     ****************
  19. ;
  20. ; egg@dstos3.dsto.gov.au
  21. ; teg@bart.dsto.gov.au
  22. ;-----------------------------------------------------------------------
  23.  
  24. include xlib.inc
  25. include xcircle.inc
  26.  
  27. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  28. ; _x_circle
  29. ;
  30. ; Draw a circle.
  31. ;
  32. ; C near-callable as:
  33. ; int x_circle (WORD Left, WORD Top, WORD Diameter,
  34. ;                WORD Color, WORD ScreenOffs);
  35. ;
  36. ; No clipping is performed.
  37. ;
  38. ; ax, bx, cx, and dx bite the dust, as Homer would say.
  39.  
  40. ; we plot into eight arcs at once:
  41. ;      4 0
  42. ;    6 \|/ 2
  43. ;     --*--
  44. ;    7 /|\ 3
  45. ;      5 1
  46. ;
  47. ; 0, 1, 4, and 5 are considered x-major; the rest, y-major.
  48. ;
  49. ; The x-major plots grow out from the top and bottom of the circle,
  50. ; while the y-major plots start at the left and right edges.
  51.  
  52.     .data
  53.  
  54.     align 2
  55.  
  56. ColumnMask      db      011h,022h,044h,088h
  57.  
  58.     .code
  59.  
  60.     public _x_circle
  61.     align   2
  62. _x_circle proc
  63. ARG Left:word, Top:word, Diameter:word, Color:word, ScreenOffs:word
  64. LOCAL offset0,offset1,offset2,offset3,offset4,offset5,offset6,offset7,mask0n1,mask2n3,mask4n5,mask6n7,shrunk_radius,diameter_even,error:word=LocalStk
  65. ; Tasm 1.0 does not allow the \ line continuation
  66. ;LOCAL offset0:word, offset1:word, offset2:word, offset3:word, \
  67. ;      offset4:word, offset5:word, offset6:word, offset7:word, \
  68. ;      mask0n1:word, mask2n3:word, mask4n5:word, mask6n7:word, \
  69. ;      shrunk_radius:word, diameter_even:word, error:word=LocalStk
  70.  
  71.     push bp
  72.     mov  bp, sp
  73.     sub  sp, LocalStk
  74.     push si
  75.     push di
  76.     push ds
  77.  
  78. ; find starting locations of plots 2, 3, 6, and 7
  79.     mov di, _ScrnLogicalByteWidth
  80.     xor dx, dx
  81.  
  82.     mov ax, Diameter    ; find vertical midpoint
  83.     dec ax
  84.     shr ax, 1
  85.     adc dx, 0           ; remember if it's rounded
  86.     mov shrunk_radius, ax ; radius, rounded down for adding
  87.     mov diameter_even, dx ; (diameter - 1) & 1, effectively
  88.     add ax, Top
  89.     mul di              ; vertical midpoint in bytes
  90.     add ax, ScreenOffs
  91.  
  92.     mov bx, Left
  93.     mov cx, bx          ; save for later
  94.     mov si, bx
  95.     shr si, 2
  96.     add si, ax
  97.     mov offset6, si
  98.     and bx, 3           ; column of left side
  99.     mov bl, ColumnMask[bx]
  100.     mov mask6n7, bx
  101.  
  102.     add cx, Diameter
  103.     dec cx
  104.     mov bx, cx
  105.     shr cx, 2
  106.     add cx, ax
  107.     mov offset2, cx
  108.     and bx, 3           ; column of right side
  109.     mov bl, ColumnMask[bx]
  110.     mov mask2n3, bx
  111.  
  112.     cmp diameter_even, 1
  113.     jne @@MiddlePlotsOverlap
  114.     add si, di
  115.     add cx, di
  116. @@MiddlePlotsOverlap:
  117.     mov offset7, si
  118.     mov offset3, cx
  119.  
  120. ; starting locations of 0, 1, 4, and 5
  121.     mov bx, Left
  122.     add bx, shrunk_radius ; find horizontal midpoint
  123.  
  124.     mov ax, Top         ; top in bytes
  125.     mul di
  126.     add ax, ScreenOffs
  127.     mov si, ax
  128.  
  129.     mov ax, Diameter    ; bottom in bytes
  130.     dec ax
  131.     mul di
  132.     add ax, si
  133.  
  134.     mov di, bx          ; horizontal midpoint in bytes
  135.     shr di, 2
  136.     add si, di             ; top midpoint in bytes
  137.     mov offset4, si
  138.     add di, ax             ; bottom midpoint in bytes
  139.     mov offset5, di
  140.     and bx, 3           ; column of horizontal midpoint
  141.     mov bl, ColumnMask[bx]
  142.     mov mask4n5, bx
  143.  
  144.     cmp diameter_even, 1
  145.     jne @@TopAndBottomPlotsOverlap
  146.     rol bl, 1
  147.     jnc @@TopAndBottomPlotsOverlap
  148.     inc si
  149.     inc di
  150. @@TopAndBottomPlotsOverlap:
  151.     mov offset0, si
  152.     mov offset1, di
  153.     mov mask0n1, bx
  154.  
  155. ; we've got our eight plots in their starting positions, so
  156. ; it's time to sort out the registers
  157.     mov bx, _ScrnLogicalByteWidth
  158.  
  159.     mov dx, SCREEN_SEG
  160.     mov ds, dx
  161.  
  162.     mov dx, SC_INDEX    ; set VGA to accept column masks
  163.     mov al, MAP_MASK
  164.     out dx, al
  165.     inc dx              ; gun the engine...
  166.  
  167.     mov si, Diameter    ; initial y is radius -- 2 #s per pixel
  168.     inc si
  169.  
  170.     mov cx, si
  171.     neg cx
  172.     add cx, 2
  173.     mov error, cx        ; error = -y + one pixel since we're a step ahead
  174.  
  175.     xor cx, cx          ; initial x = 0
  176.     mov ah, byte ptr Color
  177.     jmp @@CircleCalc    ; let's actually put something on the screen!
  178.  
  179. ; move the x-major plots horizontally and the y-major plots vertically
  180. @@NoAdvance:
  181.     mov al, byte ptr mask0n1
  182.     out dx, al
  183.     mov di, offset0     ; plot 0
  184.     mov [di], ah
  185.     rol al, 1           ; advance 0 right
  186.     mov byte ptr mask0n1, al
  187.     adc di, 0
  188.     mov offset0, di
  189.     mov di, offset1
  190.     mov [di], ah        ; plot 1
  191.     ror al, 1           ; what was that bit again?
  192.     adc di, 0           ; advance 1 right
  193.     mov offset1, di
  194.  
  195.     mov al, byte ptr mask2n3
  196.     out dx, al
  197.     mov di, offset2
  198.     mov [di], ah        ; plot 2
  199.     sub di, bx          ; advance 2 up
  200.     mov offset2, di
  201.     mov di, offset3
  202.     mov [di], ah        ; plot 3
  203.     add di, bx          ; advance 3 down
  204.     mov offset3, di
  205.  
  206.     mov al, byte ptr mask4n5
  207.     out dx, al
  208.     mov di, offset4
  209.     mov [di], ah
  210.     ror al, 1
  211.     mov byte ptr mask4n5, al
  212.     sbb di, 0
  213.     mov offset4, di
  214.     mov di, offset5
  215.     mov [di], ah
  216.     rol al, 1
  217.     sbb di, 0
  218.     mov offset5, di
  219.  
  220.     mov al, byte ptr mask6n7
  221.     out dx, al
  222.     mov di, offset6
  223.     mov [di], ah
  224.     sub di, bx
  225.     mov offset6, di
  226.     mov di, offset7
  227.     mov [di], ah
  228.     add di, bx
  229.     mov offset7, di
  230.  
  231.     jmp @@CircleCalc
  232.  
  233. ; move all plots diagonally
  234. @@Advance:
  235.     mov al, byte ptr mask0n1
  236.     out dx, al
  237.     mov di, offset0
  238.     mov [di], ah        ; plot 0
  239.     rol al, 1           ; advance 0 right and down
  240.     mov byte ptr mask0n1, al
  241.     adc di, bx
  242.     mov offset0, di
  243.     mov di, offset1
  244.     mov [di], ah        ; plot 1
  245.     ror al, 1           ; what was that bit again?
  246.     adc di, 0           ; advance 1 right and up
  247.     sub di, bx
  248.     mov offset1, di
  249.  
  250.     mov al, byte ptr mask2n3
  251.     out dx, al
  252.     mov di, offset2
  253.     mov [di], ah        ; plot 2
  254.     ror al, 1           ; advance 2 up and left
  255.     mov byte ptr mask2n3, al
  256.     sbb di, bx
  257.     mov offset2, di
  258.     mov di, offset3
  259.     mov [di], ah        ; plot 3
  260.     rol al, 1
  261.     sbb di, 0           ; advance 3 down and left
  262.     add di, bx
  263.     mov offset3, di
  264.  
  265.     mov al, byte ptr mask4n5
  266.     out dx, al
  267.     mov di, offset4
  268.     mov [di], ah
  269.     ror al, 1
  270.     mov byte ptr mask4n5, al
  271.     sbb di, 0
  272.     add di, bx
  273.     mov offset4, di
  274.     mov di, offset5
  275.     mov [di], ah
  276.     rol al, 1
  277.     sbb di, bx
  278.     mov offset5, di
  279.  
  280.     mov al, byte ptr mask6n7
  281.     out dx, al
  282.     mov di, offset6
  283.     mov [di], ah
  284.     rol al, 1
  285.     mov byte ptr mask6n7, al
  286.     adc di, 0
  287.     sub di, bx
  288.     mov offset6, di
  289.     mov di, offset7
  290.     mov [di], ah
  291.     ror al, 1
  292.     adc di, bx
  293.     mov offset7, di
  294.  
  295. ; do you realize the entire function has been set up for this little jot?
  296. ; keep in mind that radii values are 2 per pixel
  297. @@CircleCalc:
  298.     add cx, 2           ; x += 1
  299.     mov di, error
  300.     add di, cx          ; error += (2 * x) + 1
  301.     inc di
  302.     jl @@CircleNoError
  303.     cmp cx, si          ; x > y?
  304.     ja @@FleeFlyFlowFum
  305.     sub si, 2           ; y -= 1
  306.     sub di, si          ; error -= (2 * y)
  307.     mov error, di
  308.     jmp @@Advance
  309. @@CircleNoError:
  310.     mov error, di
  311.     jmp @@NoAdvance
  312.  
  313. @@FleeFlyFlowFum:
  314.     pop ds
  315.     pop di
  316.     pop si
  317.     mov sp,bp
  318.     pop bp
  319.  
  320.     ret
  321.  
  322. _x_circle endp
  323.  
  324.  
  325. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  326. ; _x_filled_circle
  327. ;
  328. ; Draw a disc.
  329. ;
  330. ; C near-callable as:
  331. ; int x_filled_circle (WORD Left, WORD Top, WORD Diameter,
  332. ;                      WORD Color, WORD ScreenOffs);
  333. ;
  334. ; No clipping is performed.
  335. ;
  336. ; ax, bx, cx, dx, and es bite the dust, as Homer would say.
  337. ; DF is set to 0 (strings go forward).
  338.  
  339.     .data
  340.  
  341.     align 2
  342.  
  343. ; the only entries of these tables which are used are positions
  344. ; 1, 2, 4, and 8
  345. LeftMaskTable   db      0, 0ffh, 0eeh, 0, 0cch, 0, 0, 0, 088h
  346. RightMaskTable  db        0, 011h, 033h, 0, 077h, 0, 0, 0, 0ffh
  347.  
  348.     .code
  349.  
  350.     public _x_filled_circle
  351.     align   2
  352. _x_filled_circle proc
  353. ARG Left:word, Top:word, Diameter:word, Color:word, ScreenOffs:word
  354. ; Tasm 1.0 does not allow the \ line continuation
  355. ;LOCAL offset0:word, offset1:word, offset2:word, offset3:word, \
  356. ;      offset4:word, offset5:word, offset6:word, offset7:word, \
  357. ;      mask0n1:word, mask2n3:word, mask4n5:word, mask6n7:word, \
  358. ;      shrunk_radius:word, diameter_even:word, error:word, \
  359. ;      jump_vector:word=LocalStk
  360. LOCAL offset0,offset1,offset2,offset3,offset4,offset5,offset6,offset7,mask0n1,mask2n3,mask4n5,mask6n7,shrunk_radius,diameter_even,error,jump_vector:word=LocalStk
  361.  
  362.     push bp
  363.     mov  bp, sp
  364.     sub  sp, LocalStk
  365.     push si
  366.     push di
  367.  
  368.     cld                    ; strings march forward
  369.  
  370. ; this first part is identical to the other function --
  371. ; the only differences, in fact, are in the drawing and moving around
  372.  
  373. ; find starting locations of plots 2, 3, 6, and 7
  374.     mov di, _ScrnLogicalByteWidth
  375.     xor dx, dx
  376.  
  377.     mov ax, Diameter    ; find vertical midpoint
  378.     dec ax
  379.     shr ax, 1
  380.     adc dx, 0           ; remember if it's rounded
  381.     mov shrunk_radius, ax ; radius, rounded down for adding
  382.     mov diameter_even, dx ; (diameter - 1) & 1, effectively
  383.     add ax, Top
  384.     mul di              ; vertical midpoint in bytes
  385.     add ax, ScreenOffs
  386.  
  387.     mov bx, Left
  388.     mov cx, bx          ; save for later
  389.     mov si, bx
  390.     shr si, 2
  391.     add si, ax
  392.     mov offset6, si
  393.     and bx, 3           ; column of left side
  394.     mov bl, ColumnMask[bx]
  395.     mov mask6n7, bx
  396.  
  397.     add cx, Diameter
  398.     dec cx
  399.     mov bx, cx
  400.     shr cx, 2
  401.     add cx, ax
  402.     mov offset2, cx
  403.     and bx, 3           ; column of right side
  404.     mov bl, ColumnMask[bx]
  405.     mov mask2n3, bx
  406.  
  407.     cmp diameter_even, 1
  408.     jne @@MiddlePlotsOverlap
  409.     add si, di
  410.     add cx, di
  411. @@MiddlePlotsOverlap:
  412.     mov offset7, si
  413.     mov offset3, cx
  414.  
  415. ; starting locations of 0, 1, 4, and 5
  416.     mov bx, Left
  417.     add bx, shrunk_radius ; find horizontal midpoint
  418.  
  419.     mov ax, Top         ; top in bytes
  420.     mul di
  421.     add ax, ScreenOffs
  422.     mov si, ax
  423.  
  424.     mov ax, Diameter    ; bottom in bytes
  425.     dec ax
  426.     mul di
  427.     add ax, si
  428.  
  429.     mov di, bx          ; horizontal midpoint in bytes
  430.     shr di, 2
  431.     add si, di             ; top midpoint in bytes
  432.     mov offset4, si
  433.     add di, ax             ; bottom midpoint in bytes
  434.     mov offset5, di
  435.     and bx, 3           ; column of horizontal midpoint
  436.     mov bl, ColumnMask[bx]
  437.     mov mask4n5, bx
  438.  
  439.     cmp diameter_even, 1
  440.     jne @@TopAndBottomPlotsOverlap
  441.     rol bl, 1
  442.     jnc @@TopAndBottomPlotsOverlap
  443.     inc si
  444.     inc di
  445. @@TopAndBottomPlotsOverlap:
  446.     mov offset0, si
  447.     mov offset1, di
  448.     mov mask0n1, bx
  449.  
  450. ; we've got our eight plots in their starting positions, so
  451. ; it's time to sort out the registers
  452.     mov bx, _ScrnLogicalByteWidth
  453.  
  454.     mov dx, SCREEN_SEG
  455.     mov es, dx
  456.  
  457.     mov dx, SC_INDEX    ; set VGA to accept column masks
  458.     mov al, MAP_MASK
  459.     out dx, al
  460.     inc dx              ; gun the engine...
  461.  
  462.     mov si, Diameter    ; initial y is radius -- 2 #s per pixel
  463.     inc si
  464.  
  465.     mov cx, si
  466.     neg cx
  467.     add cx, 2
  468.     mov error, cx        ; error = -y + one pixel since we're a step ahead
  469.  
  470.     xor cx, cx          ; initial x = 0
  471.     mov ah, byte ptr Color
  472.     jmp @@FilledCircleCalc ; let's actually put something on the screen!
  473.  
  474.  
  475. ; plotting is completely different from in the other function (naturally)
  476. @@PlotLines:
  477.     push cx                ; we'll need cx for string stores
  478.  
  479. ; draw x-major horz. lines, from plot 4 to plot 0 and from plot 5 to plot 1
  480.     mov di, mask0n1
  481.     and di, 0000fh        ; we only want the lower nybble for the mask table
  482.     mov al, RightMaskTable[di]
  483.     mov di, offset0        ; left and right offsets the same?
  484.     cmp di, offset4
  485.     jne @@PlotXMajorNontrivial ; try and say this one 10 times fast!
  486.     mov di, mask4n5
  487.     and di, 0000fh
  488.     and al, LeftMaskTable[di] ; intersection of left & right masks
  489.     out dx, al            ; set mask
  490.     mov di, offset4
  491.     mov es:[di], ah
  492.     mov di, offset5
  493.     mov es:[di], ah
  494.     jmp @@PlotYMajor
  495. @@PlotXMajorNontrivial:
  496.     out dx, al          ; draw right edge
  497.     mov es:[di], ah
  498.     mov di, offset1
  499.     mov es:[di], ah
  500.  
  501.     mov di, mask4n5        ; draw left edge
  502.     and di, 0000fh
  503.     mov al, LeftMaskTable[di]
  504.     out dx, al
  505.     mov di, offset4
  506.     mov es:[di], ah
  507.     mov di, offset5
  508.     mov es:[di], ah
  509.  
  510.     mov al, 0ffh        ; set mask for middle chunks
  511.     out dx, al
  512.     mov al, ah            ; ready to store two pixels at a time
  513.     inc di                ; move string start past left edge
  514.     mov cx, offset1        ; store line from plot 5 to plot 1, exclusive
  515.     sub cx, di            ; width of section in bytes
  516.     push cx
  517.     shr cx, 1            ; draw midsection eight pixels at a time
  518.     rep stosw
  519.     adc cx, 0            ; draw last four pixels, if such there are
  520.     rep stosb
  521.  
  522.     mov di, offset4        ; draw line from plot 4 to plot 0
  523.     inc di                ; move past left edge
  524.     pop cx
  525.     shr cx, 1
  526.     rep stosw
  527.     adc cx, 0
  528.     rep stosb
  529.  
  530. @@PlotYMajor:
  531. ; draw y-major horz. lines, from plot 6 to plot 2 and from plot 7 to plot 3
  532.     mov di, mask2n3
  533.     and di, 0000fh        ; we only want the lower nybble for the mask table
  534.     mov al, RightMaskTable[di]
  535.     mov di, offset2        ; left and right offsets the same?
  536.     cmp di, offset6
  537.     jne @@PlotYMajorNontrivial ; try and say this one 10 times fast!
  538.     mov di, mask6n7
  539.     and di, 0000fh
  540.     and al, LeftMaskTable[di] ; intersection of left & right masks
  541.     out dx, al            ; set mask
  542.     mov di, offset6
  543.     mov es:[di], ah
  544.     mov di, offset7
  545.     mov es:[di], ah
  546.     jmp @@ClimaxOfPlot
  547. @@PlotYMajorNontrivial:
  548.     out dx, al          ; draw right edge
  549.     mov es:[di], ah
  550.     mov di, offset3
  551.     mov es:[di], ah
  552.  
  553.     mov di, mask6n7        ; draw left edge
  554.     and di, 0000fh
  555.     mov al, LeftMaskTable[di]
  556.     out dx, al
  557.     mov di, offset6
  558.     mov es:[di], ah
  559.     mov di, offset7
  560.     mov es:[di], ah
  561.  
  562.     mov al, 0ffh        ; set mask for middle chunks
  563.     out dx, al
  564.     mov al, ah            ; ready to store two pixels at a time
  565.  
  566.     inc di                ; move string start past left edge
  567.     mov cx, offset3        ; draw line from plot 7 to plot 3, exclusive
  568.     sub cx, di            ; width of section in bytes
  569.     push cx
  570.     shr cx, 1            ; store midsection
  571.     rep stosw
  572.     adc cx, 0
  573.     rep stosb
  574.  
  575.     mov di, offset6        ; draw line from plot 6 to plot 2
  576.     inc di                ; move past left edge
  577.     pop cx
  578.     shr cx, 1
  579.     rep stosw
  580.     adc cx, 0
  581.     rep stosb
  582.  
  583. @@ClimaxOfPlot:
  584.     pop cx
  585.     jmp [jump_vector]    ; either @@Advance or @@NoAdvance
  586.  
  587.  
  588. ; unlike their counterparts in the other function, these do not draw --
  589. ; they only move the eight pointers
  590.  
  591. ; move the x-major plots horizontally and the y-major plots vertically
  592. @@NoAdvance:
  593.     mov al, byte ptr mask0n1 ; advance left x-major plots
  594.     mov di, offset0
  595.     rol al, 1           ; advance 0 right
  596.     mov byte ptr mask0n1, al
  597.     adc di, 0
  598.     mov offset0, di
  599.     mov di, offset1
  600.     ror al, 1           ; what was that bit again?
  601.     adc di, 0           ; advance 1 right
  602.     mov offset1, di
  603.  
  604.     mov al, byte ptr mask4n5 ; advance left x-major plots
  605.     mov di, offset4
  606.     ror al, 1
  607.     mov byte ptr mask4n5, al
  608.     sbb di, 0
  609.     mov offset4, di
  610.     mov di, offset5
  611.     rol al, 1
  612.     sbb di, 0
  613.     mov offset5, di
  614.  
  615.     mov al, byte ptr mask2n3
  616.     mov di, offset2
  617.     sub di, bx          ; advance 2 up
  618.     mov offset2, di
  619.     mov di, offset3
  620.     add di, bx          ; advance 3 down
  621.     mov offset3, di
  622.  
  623.     mov al, byte ptr mask6n7
  624.     mov di, offset6
  625.     sub di, bx
  626.     mov offset6, di
  627.     mov di, offset7
  628.     add di, bx
  629.     mov offset7, di
  630.  
  631.     jmp @@FilledCircleCalc
  632.  
  633. ; move all plots diagonally
  634. @@Advance:
  635.     mov al, byte ptr mask0n1
  636.     mov di, offset0
  637.     rol al, 1           ; advance 0 right and down
  638.     mov byte ptr mask0n1, al
  639.     adc di, bx
  640.     mov offset0, di
  641.     mov di, offset1
  642.     ror al, 1           ; what was that bit again?
  643.     adc di, 0           ; advance 1 right and up
  644.     sub di, bx
  645.     mov offset1, di
  646.  
  647.     mov al, byte ptr mask2n3
  648.     mov di, offset2
  649.     ror al, 1           ; advance 2 up and left
  650.     mov byte ptr mask2n3, al
  651.     sbb di, bx
  652.     mov offset2, di
  653.     mov di, offset3
  654.     rol al, 1
  655.     sbb di, 0           ; advance 3 down and left
  656.     add di, bx
  657.     mov offset3, di
  658.  
  659.     mov al, byte ptr mask4n5
  660.     mov di, offset4
  661.     ror al, 1
  662.     mov byte ptr mask4n5, al
  663.     sbb di, 0
  664.     add di, bx
  665.     mov offset4, di
  666.     mov di, offset5
  667.     rol al, 1
  668.     sbb di, bx
  669.     mov offset5, di
  670.  
  671.     mov al, byte ptr mask6n7
  672.     mov di, offset6
  673.     rol al, 1
  674.     mov byte ptr mask6n7, al
  675.     adc di, 0
  676.     sub di, bx
  677.     mov offset6, di
  678.     mov di, offset7
  679.     ror al, 1
  680.     adc di, bx
  681.     mov offset7, di
  682.  
  683. ; do you realize the entire function has been set up around this little jot?
  684. ; keep in mind that radii values are 2 per pixel
  685. @@FilledCircleCalc:
  686.     add cx, 2           ; x += 1
  687.     mov di, error
  688.     add di, cx          ; error += (2 * x) + 1
  689.     inc di
  690.     jl @@FilledCircleNoError
  691.     cmp cx, si          ; x > y?
  692.     ja @@FleeFlyFlowFum
  693.     sub si, 2           ; y -= 1
  694.     sub di, si          ; error -= (2 * y)
  695.     mov error, di
  696.     mov jump_vector, offset @@Advance
  697.     jmp @@PlotLines
  698. @@FilledCircleNoError:
  699.     mov error, di
  700.     mov jump_vector, offset @@NoAdvance
  701.     jmp @@PlotLines
  702.  
  703. @@FleeFlyFlowFum:
  704.     pop di
  705.     pop si
  706.     mov sp,bp
  707.     pop bp
  708.  
  709.     ret
  710.  
  711. _x_filled_circle endp
  712.  
  713.     end
  714.  
  715.